<template>
	<view class="wanlguide-container">
		<swiper :style="{ height: wanlsys.windowHeight + 'px' }" circular="true" :duration="duration"
			@change="swiperChange">
			<swiper-item class="item text-center">
				<!-- <view class="title" :style="{ marginTop: height + 'px' }">
					<view class="">11</view>
					<text>22</text>
				</view> -->
				<image src="https://feifan.weihankeji.com/uploads/guide.jpg" mode=""></image>
			</swiper-item>
		</swiper>
		<view class="button" :style="{ top: statusBar + 'px' }">
			<button class="cu-btn round" @tap="launchFlag">{{ jumpover }}</button>
		</view>
		<!-- <view class="indicator text-df" v-if="current != common.adData.firstAdverts.length-1">
			<view class="margin-lr-xs" v-for="(item, index) in common.adData.firstAdverts" :key="index">
				<text class="wlIcon-xuanzeanniudian" v-if="current == index"></text>
				<text class="wlIcon-xuanze" v-else></text>
			</view>
		</view> -->
		<view class="experience animation-scale-down">
			<button class="cu-btn round lg" @tap="launchFlag">{{ experience }}</button>
		</view>
	</view>
</template>

<script>
	import { mapMutations, mapActions, mapState, mapGetters } from 'vuex';
	export default {
		data() {
			return {
				wanlsys:'',
				height: 0,
				statusBar: 0,
				current: 0,
				duration: 500,
				jumpover: '跳过',
				experience: '立即體驗'
			};
		},
		computed: {
			...mapGetters(['common','initShop', 'homeTemplate', 'hasTemplate', 'isLogin'])
			// ...mapState(['common'])
		},
		onReady() {
			const sys = uni.getSystemInfoSync();
			const wanlsys = {
				top: sys.statusBarHeight,
				height: sys.statusBarHeight + uni.upx2px(90),
				screenHeight: sys.screenHeight,
				platform: sys.platform,
				model: sys.model,
				windowHeight: sys.windowHeight,
				windowBottom: sys.windowBottom,
				deviceId: sys.deviceId
			};
			// // #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-TOUTIAO || MP-WEIXIN
			// const custom = uni.getMenuButtonBoundingClientRect();
			// data.height = custom.bottom + custom.top - sys.statusBarHeight;
			// // #endif		
			// #ifdef MP-ALIPAY
			wanlsys.height = sys.statusBarHeight + sys.titleBarHeight;
			// #endif
			
			this.wanlsys = wanlsys;
			
			// #ifdef APP-PLUS
			this.height = wanlsys.height - wanlsys.top + 20;
			this.statusBar = wanlsys.top - 10;
			// #endif
			// #ifdef MP
			this.height = wanlsys.height;
			this.statusBar = wanlsys.top;
			// #endif
			// #ifdef H5
			this.height = wanlsys.height;
			this.statusBar = 15;
			// #endif
		},
		methods: {
			swiperChange(e) {
				this.current = e.detail.current;
			},
			launchFlag() {
				// 向本地存储中设置launchFlag的值，即启动标识；
				// uni.setStorage({
				// 	key: 'wanlshop:launch',
				// 	data: true
				// });
				if(this.isLogin){
					
					uni.navigateTo({
						url:'/pages/index/index'
					})
					
					// this.$Router.pushTab('/pages/index/index')
					
					
				}else{
					uni.navigateTo({
						url:'/pages/login/login'
					})
				}
				
			}
		}
	};
</script>

<style lang="scss">
	.cu-btn.lg {
		font-size: 30rpx;
	}

	.cu-btn:not([class*="bg-"]) {
		background-color: rgba(255, 255, 255, .5);
	}

	.wanlguide-container {
		position: relative;

		swiper-item {
			.title {
				margin-bottom: 40rpx;
				line-height: 1.4;
				color: rgba(255, 255, 255, 0.8);

				&>view {
					font-size: 62rpx;
				}

				&text {
					font-size: 32rpx;
					font-weight: 300;
				}
			}
		}

		image {
			width:100%;
			height: 100%;
		}

		.button {
			position: absolute;
			/* #ifdef MP */
			left: 25rpx;
			/* #endif */
			/* #ifndef MP */
			right: 25rpx;

			/* #endif */
			.cu-btn {
				padding: 0 25rpx;
				font-size: 28rpx;
				height: 56rpx;
				background-color: rgba(0, 0, 0, .2);
				color: rgba(255, 255, 255, .6);
			}
		}

		.experience {
			position: absolute;
			left: 0;
			right: 0;
			bottom: 100rpx;
			display: flex;
			justify-content: center;
		}

		.indicator {
			position: absolute;
			left: 0;
			right: 0;
			bottom: 120rpx;
			display: flex;
			justify-content: center;
			color: rgba(255, 255, 255, 0.8);
		}
	}
</style>
